<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>{:session('cp.cpsysname')}--服务商管理平台</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="{:config('webconfig.description');}">
    <meta name="keywords" content="{:config('webconfig.keywords');}">
    <meta name="author" content="runoob">
    <link rel="stylesheet" href="__STATIC_URL__/static/bootstrap/3.3.7/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="__STATIC_URL__/static/css/bootstrapSwitch.css"/>
    <link rel="stylesheet" type="text/css" href="__STATIC_URL__/static/css/index.css"/>
    <script src="__STATIC_URL__/static/jquery/2.2.1/jquery.min.js"></script>
    <script src="__STATIC_URL__/static/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <script src="__STATIC_URL__/static/js/commen.js" type="text/javascript" charset="utf-8"></script>
    <script src="__STATIC_URL__/static/js/bootstrapSwitch.js" type="text/javascript" charset="utf-8"></script>
    <script src="__STATIC_URL__/static/layer/layer.js" type="text/javascript" charset="utf-8"></script>
    <style>
        tbody td {
            text-align: center;
            vertical-align: middle !important;
        }
    </style>
</head>
<body>
{include file='public/header'/}
<section>
    <!------------------导航-------------------------->
    {include file='public/left'/}
    <!--------------------------主要内容区域------------------------------------->
    <div class="content">
        <div class="page-heading mgr15 mgl15">
            <ul class="breadcrumb">
                <li>当前位置是&nbsp;:</li>
                <li>
                    <a href="javascript:;">业务员管理</a>
                </li>
                <li class="active" style="color: #02b87f;"> 业务员列表</li>
            </ul>
        </div>
        <div class="panel panel-default panel-search mgr15 mgl15">
            <div class="panel-heading">
                <h3 class="panel-title">
                    <span class="glyphicon glyphicon-search pull-left" style="margin-right: 10px;"></span>业务员查找
                </h3>
            </div>
            <div class="panel-body">
                <form action="" method="get" class="form-horizontal table-search form-search" role="form" id="machform">
                    <div class="col-xs-12 col-sm-6 col-md-6 col-lg-4 ">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">姓名：</label>
                            <div class="col-sm-9">
                                <input type="text" autocomplete="off" disableautocomplete class="form-control"
                                       placeholder="请输入姓名" value="{$p_data['xingming']}" name="xingming">
                            </div>
                        </div>
                    </div>
                    <div class="col-xs-12 col-sm-6 col-md-6 col-lg-4 ">
                        <div class="form-group">

                        </div>
                    </div>
                </form>
            </div>
            <div class="panel-footer">
                <a href="javascript:;" class="btn btn-primary" onclick="searchform()">查找</a>
                <a href="javascript:;" class="btn btn-default" onclick="clearform()">清空</a>
            </div>
        </div>
        <div class="panel mgl15 mgr15">
            <div class="panel-heading addCharts" style="background:#ededed;">业务员列表
                {if condition="checkPath('personnel/cashieradd')"}
                <a class="btn btn-info pull-right" href="{:url('Personnel/salesmanadd')}"style="margin-top: -7px;">添加业务员</a>
                {/if}
            </div>
            <div class="panel-body">
                <table class="table table-bordered">
                    <thead>
                    <tr>
                        <th class="text-center">姓名</th>
                        <th class="text-center">帐号</th>
                        <th class="text-center">手机号</th>
                        <th class="hidden-phone text-center">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {volist name="list" id="vo"}
                    <tr>
                        <td>{$vo['loginusers']['xingming']}</td>
                        <td>{$vo['loginusers']['username']}</td>
                        <td>{$vo['loginusers']['tel']}</td>
                        <td>
                            {if condition="checkPath('personnel/salesmanedit')"}
                            <a style="display: inline-block;" class=" btn-link" href="{:url('Personnel/salesmanedit',['id'=>$vo['id']])}">修改</a>
                            {/if}
                            {if condition="checkPath('personnel/salesmandel')"}
                            <a style="display: inline-block;" href="javascript:;" class=" btn-link del" data-id="{$vo.id}" >删除</a>
                            {/if}
                        </td>

                    </tr>
                    {/volist}
                    </tbody>
                </table>
            </div>
            <!--分页-->
        </div>
        {include file='public/footer'/}
    </div>
</section>
<script src="__STATIC_URL__/static/js/template.js"></script>
</body>
<script src="__STATIC_URL__/static/js/qrcode/qrcode.js"></script>
<script src="__STATIC_URL__/static/layer/layer.js"></script>
<script type="text/javascript">
    $(function () {
//        删除员工方法
        $(".del").click(function () {
            var id = $(this).attr("data-id");
            //询问框
            layer.confirm('确认删除该业务员吗？', {
                btn: ['确认', '取消'] //按钮
            }, function () {
                $.ajax({
                    url: "{:url('personnel/salesmandel')}",
                    type: "post",
                    async: true,
                    data: {
                        id: id
                    },
                    success: function (data) {
                        if (data.code == 0) {
                            layer.msg("删除成功", {time: 500, icon: 1});
                            setTimeout("window.location.reload()", 500);
                            return false;
                        } else {
                            layer.alert(data.message, {icon: 7});
                            return false;
                        }
                    }
                })
            }, function () {
            });
        });
    });
</script>
</body>
</html>